package ca.ubc.cpsc210.waldo.model;

public class Bus {
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((direction == null) ? 0 : direction.hashCode());
		result = prime * result + minutesToDeparture;
		result = prime * result + ((route == null) ? 0 : route.hashCode());
		result = prime * result + ((stop == null) ? 0 : stop.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Bus other = (Bus) obj;
		if (direction == null) {
			if (other.direction != null)
				return false;
		} else if (!direction.equals(other.direction))
			return false;
		if (minutesToDeparture != other.minutesToDeparture)
			return false;
		if (route == null) {
			if (other.route != null)
				return false;
		} else if (!route.equals(other.route))
			return false;
		if (stop == null) {
			if (other.stop != null)
				return false;
		} else if (!stop.equals(other.stop))
			return false;
		return true;
	}

	private String direction;
	private int minutesToDeparture;
	
	private BusRoute route;
	private BusStop stop;
	
	public Bus(BusRoute route, String direction, BusStop stop, int minutesToDeparture) {
		
		this.route = route;
		this.direction = direction;
		this.stop = stop;
		this.minutesToDeparture = minutesToDeparture;
	}
	
	public String getDirection() {
		return direction;
	}
	
	public BusStop getStop() {
		return stop;
	}
	
	public int getMinutesToDeparture() {
		return minutesToDeparture;
	}

}
